<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>设置</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="css/mui.min.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}

			.mui-views,
			.mui-view,
			.mui-pages,
			.mui-page,
			.mui-page-content {
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				width: 100%;
				height: 100%;
				background-color: #efeff4;
			}

			.mui-pages {
				height: auto;
			}

			.mui-scroll-wrapper,
			.mui-scroll {
				background-color: #efeff4;
			}

			.mui-page.mui-transitioning {
				-webkit-transition: -webkit-transform 300ms ease;
				transition: transform 300ms ease;
			}

			.mui-page-left {
				-webkit-transform: translate3d(0, 0, 0);
				transform: translate3d(0, 0, 0);
			}

			.mui-ios .mui-page-left {
				-webkit-transform: translate3d(-20%, 0, 0);
				transform: translate3d(-20%, 0, 0);
			}

			.mui-navbar {
				position: fixed;
				right: 0;
				left: 0;
				z-index: 10;
				height: 44px;
				background-color: #f7f7f8;
			}

			.mui-navbar .mui-bar {
				position: absolute;
				background: transparent;
				text-align: center;
			}

			.mui-android .mui-navbar-inner.mui-navbar-left {
				opacity: 0;
			}

			.mui-ios .mui-navbar-left .mui-left,
			.mui-ios .mui-navbar-left .mui-center,
			.mui-ios .mui-navbar-left .mui-right {
				opacity: 0;
			}

			.mui-navbar .mui-btn-nav {
				-webkit-transition: none;
				transition: none;
				-webkit-transition-duration: .0s;
				transition-duration: .0s;
			}

			.mui-navbar .mui-bar .mui-title {
				display: inline-block;
				width: auto;
			}

			.mui-page-shadow {
				position: absolute;
				right: 100%;
				top: 0;
				width: 16px;
				height: 100%;
				z-index: -1;
				content: '';
			}

			.mui-page-shadow {
				background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
				background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
			}

			.mui-navbar-inner.mui-transitioning,
			.mui-navbar-inner .mui-transitioning {
				-webkit-transition: opacity 300ms ease, -webkit-transform 300ms ease;
				transition: opacity 300ms ease, transform 300ms ease;
			}

			.mui-page {
				display: none;
			}

			.mui-pages .mui-page {
				display: block;
			}

			.mui-page .mui-table-view:first-child {
				margin-top: 15px;
			}

			.mui-page .mui-table-view:last-child {
				margin-bottom: 30px;
			}

			.mui-table-view {
				margin-top: 20px;
			}

			.mui-table-view span.mui-pull-right {
				color: #999;
			}

			.mui-table-view-divider {
				background-color: #efeff4;
				font-size: 14px;
			}

			.mui-table-view-divider:before,
			.mui-table-view-divider:after {
				height: 0;
			}

			.head {
				height: 40px;
			}

			#head {
				line-height: 40px;
			}

			.head-img {
				width: 40px;
				height: 40px;
			}

			#head-img1 {
				position: absolute;
				bottom: 10px;
				right: 40px;
				width: 40px;
				height: 40px;
			}

			.update {
				font-style: normal;
				color: #999999;
				margin-right: -25px;
				font-size: 15px
			}

			.mui-fullscreen {
				position: fixed;
				z-index: 20;
				background-color: #000;
			}

			.mui-ios .mui-navbar .mui-bar .mui-title {
				position: static;
			}

			/*问题反馈在setting页面单独的css*/
			#feedback .mui-popover {
				position: fixed;
			}

			#feedback .mui-table-view:last-child {
				margin-bottom: 0px;
			}

			#feedback .mui-table-view:first-child {
				margin-top: 0px;
			}

			.mui-plus.mui-plus-stream .mui-stream-hidden {
				display: none !important;
			}

			/*问题反馈在setting页面单独的css==end*/
		</style>
		<link rel="stylesheet" type="text/css" href="css/feedback.css" />
	</head>

	<body class="mui-fullscreen">
		<!--页面主结构开始-->
		<div id="app" class="mui-views">
			<div class="mui-view">

				<div class="mui-pages">
				</div>
			</div>
		</div>
		<!--页面主结构结束-->
		<!--单页面开始-->
		<div id="setting" class="mui-page">
			<!--页面主内容区开始-->
			<div class="mui-page-content">
				<div class="mui-scroll-wrapper">
					<div class="mui-scroll">
						<ul id="ul1" class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell mui-media">
								<a class="mui-navigate-right" href="user_eidt_self.html">
									<span class="mui-icon mui-icon-contact mui-icon-icon-contact-filled mui-pull-left"
										style="font-size: 36px;"></span>
									<div class="mui-media-body">
										<span id="txtName">一个小目标</span>
										<p class='mui-ellipsis'>账号: <span id="txtAccount">81192</span></p>
									</div>
								</a>
							</li>
						</ul>

						<ul id="ul2" style="display: none;" class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<a href="user_list.html" class="mui-navigate-right">用户管理</a>
							</li>
						</ul>

						<ul id="ul3" style="display: none;" class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<a href="tag_list.html" class="mui-navigate-right">标签管理</a>
							</li>
							<li class="mui-table-view-cell">
								<a href="site_list.html" class="mui-navigate-right">数组管理</a>
							</li>
							<li class="mui-table-view-cell">
								<a href="threshold_list.html" class="mui-navigate-right">阈值管理</a>
							</li>
						</ul>

						<ul id="ul4" style="display: none;" class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<a href="map_tagtype.html" class="mui-navigate-right">标签类型映射</a>
							</li>
							<li class="mui-table-view-cell">
								<a href="map_tag.html" class="mui-navigate-right">标签映射</a>
							</li>
						</ul>

						<ul id="ul5" style="display: none;" class="mui-table-view mui-table-view-chevron">
							<li class="mui-table-view-cell">
								<span>清空数据</span>
								<div class="mui-switch">
									<div class="mui-switch-handle"></div>
								</div>
							</li>
						</ul>
						<ul class="mui-table-view">
							<li class="mui-table-view-cell" style="text-align: center;" onclick="User_LoginOut()">
								<a>退出登录</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!--页面主内容区结束-->
		</div>
	</body>
	<script src="js/mui.min.js "></script>
	<script src="js/mui.view.js "></script>
	<script src="js/jquery.min.js"></script>
	<script src="libs/lib.js"></script>
	<script>
		mui.init();
		//初始化单页view
		var viewApi = mui('#app').view({
			defaultPage: '#setting'
		});

		//初始化单页的区域滚动
		mui('.mui-scroll-wrapper').scroll();
		User_Info();
		Page_init();

		function Page_init() {
			mui('.mui-switch').each(function() {
				//this.parentNode.querySelector('span').innerText = '状态：' + (this.classList.contains('mui-active') ? 'true' : 'false');
				this.addEventListener('toggle', function(event) {
					//this.parentNode.querySelector('span').innerText = '状态：' + (event.detail.isActive ? 'true' : 'false');
					if (event.detail.isActive) {
						Core.Msg.Confirm("您确定要删除所有数据吗？", null, null, function(e) {
							if (e.index != 1) {
								return;
							}
							Core.Post("Record/Clear", {}, function(result, status) {
								if (result.errorMsg) {
									Core.Msg.Alert(result.errorMsg);									
									return;
								}
								Core.Msg.Tip("操作成功");
								top.Page_RefreshAll();
							});
						})
					}
				});
			});
		}

		function User_Info() {
			var user = Core.User.GetUser();
			if (!user) {
				return;
			}
			document.getElementById("txtName").innerHTML = user.userName;
			document.getElementById("txtAccount").innerHTML = user.account;

			if (user.isAdmin === 1) {
				for (var i = 2; i <= 5; i++) {
					if (i == 4)
						continue;
					document.getElementById("ul" + i).style.display = "";
				}
			}
		}

		function User_LoginOut() {
			var user = Core.User.GetUser();
			Core.Post("Auth/LoginOut", {
				id: user.id
			}, function(result, status) {
				if (result.errorMsg) {
					Core.Msg.Alert(result.errorMsg);
					return;
				}
				Core.User.RemoveUser();
				Core.Token.RemoveToken();
				Core.Tool.Back("login");
			});
		}
	</script>

</html>